// Author: Bjorn Schobben

#include "Score.h"

Score::Score()
{
}

Score::Score(const Score& rhs)
{
	name = rhs.name;
	colorCount = rhs.colorCount;
	time = rhs.time;
	stepCount = rhs.stepCount;
}

Score::~Score()
{
}

//Set the name of the player
void Score::SetName(const std::string newName)
{
	name = newName;
}

//Get the name of the player
const std::string& Score::GetName(void) const
{
	return name;
}

//Set the amount of colors used to complete the game
void Score::SetColorCount(const unsigned int newColorCount)
{
	colorCount = newColorCount;
}

//Get the amount of colors used to complete the game
const unsigned int Score::GetColorCount(void) const 
{
	return colorCount;
}

//Set the time needed to complete the game
void Score::SetTime(const unsigned int newTime)
{
	time = newTime;
}

//Get the time needed to complete the game
const unsigned int Score::GetTime(void) const
{
	return time;
}

//Set the amount of steps needed to complete the game
void Score::SetStepCount(const unsigned int newStepCount)
{
	stepCount = newStepCount;
}

//Get the amount of steps needed to complete the game
const unsigned int Score::GetStepCount(void) const
{
	return stepCount;
}

//Overloaded operator == for scores
bool Score::operator==(const Score& rhs) const
{
	return(rhs.GetName() == name && rhs.GetColorCount() == colorCount && rhs.GetStepCount() == stepCount && rhs.GetTime() == time);
}

//Overloaded operator < for scores
bool Score::operator<(const Score& rhs) const
{
	bool smaller = false;
	//If the color count is smaller, the score is smaller
	if(colorCount < rhs.GetColorCount())
		smaller = true;
	//If the color counts are equal but the time is smaller, the score is smaller
	else if(colorCount == rhs.GetColorCount() && time < rhs.GetTime())
		smaller = true;
	//If the color counts and the times are equal but the step count is smaller, the score is smaller
	else if(colorCount == rhs.GetColorCount() && time == rhs.GetTime() && stepCount < rhs.GetStepCount())
		smaller = true;
		
	return smaller;
}